
import React from 'react';
import { View, StyleSheet, Text } from 'react-native';
import VideoControls from 'react-native-video-custom-controls';

function Item(props) {
    const { data, paused, setCurrentId } = props;
    const onPlay = () => {
        setCurrentId(data.id);
    };
    const onPause = () => {
        setCurrentId('');
    };

    return <View>
        <Text>{data.title}</Text>
        <VideoControls
            onPlay={onPlay}
            onPause={onPause}
            paused={paused}
            source={{ uri: data.videoUrl }}
            style={styles.video}
        />
    </View>
}

const styles = StyleSheet.create({
    video: {
        height: 220,
    },
});

export default Item;